package com.kunda.netty.protocol.aspect;

import java.lang.reflect.Method;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;

import com.kunda.netty.protocol.RHMS.MsgType;
import com.kunda.netty.protocol.annotation.RequestHandler;

@Aspect
public class SessionCheckAspect {

	@Pointcut("@annotation(com.kunda.netty.annotation.RequestHandler)")
	public void anyMethod(){}
	
	@Before("anyMethod()")
	public void check(JoinPoint  joinPoint){
		Method method = ((MethodSignature)joinPoint.getSignature()).getMethod();
		Object[] args = joinPoint.getArgs();
		
		RequestHandler annotation = method.getAnnotation(RequestHandler.class);
		MsgType msgType = annotation.value();
		
	}
	
}
